<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="http://localhost/NEWCLASS_515151/nubiya/hdphp/Static/css/myorder.css" />
		<script language="javascript" src="http://localhost/NEWCLASS_515151/nubiya/hdphp/Static/js/address.js"></script>
        <script type="text/javascript" src="http://localhost/NEWCLASS_515151/nubiya/hdphp/Static/js/jquery-1.8.2.min.js">
        </script>
		<script language="javascript">
		var s=["s1","s2","s3"];
		var opt0 = ["请选择省","请选择市","请选择县（区）"];
		function setup(){
		 for(i=0;i<s.length-1;i++)
		  document.getElementById(s[i]).onclick=new Function("change("+(i+1)+")");
		 change(0);
		}
		window.onload=function(){
		setup()	
			
		};

		</script>
		<script>
			$(function(){
//				收件人输入框失去焦点事件
				$('#sjr').blur(function(){
					var re=$.trim($(this).val());
					if(re==''){
						$(this).attr('finish',0);
						$(this).next().show();
						
					}else{
						$(this).attr('finish',1);
					}
					
				})
//				收件人获得焦点事件
				$('#sjr').focus(function(){
					
					
						$(this).next().hide();
					
					
				})

                

//              收货地址
				$('#shouhuodizhi').blur(function(){
					var re=$.trim($(this).val());
					if(re==''){
						$(this).attr('finish',0);
						$(this).next().show();
						
					}else{
						$(this).attr('finish',1);
					}
					
				})
//				收件地址获得焦点事件
				$('#shouhuodizhi').focus(function(){
					
						$(this).next().hide();
					
					
				})
				//             邮编输入框
				$('#youbian').blur(function(){
					var re=$.trim($(this).val());
					if(re==''){
						$(this).attr('finish',0);
						$(this).next().show();
						
					}else{
						$(this).attr('finish',1);
					}
					
				})
//				邮编输入框获得焦点事件
				$('#youbian').focus(function(){
					
						$(this).next().hide();
					
					
				})
//				电话
				$('#dianhua').blur(function(){
					var re=$.trim($(this).val());
					if(re==''){
						$(this).attr('finish',0);
						
						$(this).next().show();
						
					}else{
						$(this).attr('finish',1);
					}
					
				})
//				电话获得焦点事件
				$('#dianhua').focus(function(){
					$(this).next().hide();
					
				})
				//				手机
				$('#shouji').blur(function(){
					var re=$.trim($(this).val());
					if(re==''){
						$(this).attr('finish',0);
						$(this).next().show();
						
					}else{
						$(this).attr('finish',1);
					}
					
				})
//				手机获得焦点事件
				$('#shouji').focus(function(){
			        $(this).next().hide();
				})



			})
		</script>

	</head>
	<body>
			<div class="top">
				<div class="topbar">
				
					<div class="left">
						<ul>
							<li class="logo">
		                     
						       <a href=""></a>
							</li>
							<li class="twofont"><a href="">商城</a></li>
							<li class="twofont"><a href="">手机</a></li>
							<li class="twofont"><a href="">配件</a></li>
							<li class="threefont"><a href="">体验店</a></li>
						</ul>
					
						
					</div>
					<div class="right">
						<ul>
							 <li class="login">
							    <span></span>
							 	<a href="">注册</a>
							 	<a href="">登录</a>
							 </li>
					       
					         <li class="cart">
					   	        <a href=""></a>
					         </li>
						</ul>
					  
						
					</div>
				</div>
			</div>
			<div class="orderbj">
				<p>
					<a href="">首页&nbsp&nbsp></a><a href="">&nbsp&nbsp您的购物车&nbsp&nbsp></a><a href="">&nbsp&nbsp填写购物车</a>
				</p>
		    </div>
		    <h2 class="shdz">我的收货地址</h2>
		    <div class="useaddr">
		    	<input type="radio" name="receiveaddress" checked class="otheraddress"/>
		    	使用其他地址
		    </div>
		    <div class="address">
			    <form action="" method="post">
			    	收件人：<input type="text" finish="0" id="sjr"/><span class="warning sjrw" style="display:none">必须填写收件人(2-30个字符)</span>
			    	<br />
			    	
			    	省份：
			    	<select id="s1" name="province" finish="0">
	                        <option>省份</option>
                    </select>
                  
                    <select id="s2" name="city" finish="0">
	                        <option>地级市</option>
                    </select>
                 
                    <select id="s3" name="county" finish="0">
	                        <option>市、县级市、县</option>
                    </select>
                    <br />
                
                  
              
                    <script type="text/javascript">
						change(0);
						function initArea(){
							
							$('#s1').find("option[value='北京']").click();
						}
						initArea();
					</script>
			    		
			    	</select>
			    
			    	收货地址：<input type="text" id="shouhuodizhi" finish="0"/>
			    	<span class="warning shdzw" style="display:none" >必须填写收货地址(0-30个字符)</span>
			    	<br />
			    	邮编：<input type="text" id="youbian"  finish="0"/><span class="warning ybw" style="display:none">请填写正确的邮编</span>
			    	<br />
			    	电话：<input type="text" id="dianhua"  finish="0"/><span class="warning dhw" style="display:none">请填写正确的电话</span>
			    	<br />
			    	手机：<input type="text" id="shouji" finish="0"/><span class="warning sjw" style="display:none">请填写11为手机号</span>
			    	<br />
			    	配送时间：<select name="" id="pssj">
			    		<option value="">只工作日送货（双休日，假日不配送）</option>
			    		<option value="">工作日，双休日，节假日均可配送</option>
			    		<option value="">只双休日，节假日配送</option>
			    	</select>
			    	<br />
			    	<a href="javascript:;" class="bcxdz" onclick="save()">保存新地址</a>
	
			    </form>
		    </div>
		    <div id="saveaddress">
		    	<?php foreach ($addressData as $k=>$v){?>
		    		<p>
		    			<input type="radio" name="receiveaddress" class="added" checked/>
			    	<span class="name">
			    	<?php echo $v['sjrname'];?>
			    	</span>
			       <span class="shaddress">
			    	<?php echo $v['shdz'];?>
			    	</span>
			    	<span><?php echo $v['province'];?></span>
			    	<span class="small"><?php echo $v['city'];?></span>
			    	<span class="small"><?php echo $v['county'];?></span>
			    	<span class="small"><?php echo $v['youbian'];?></span>
			    	<span class="yb">电话</span>
			    	<span>
			    		<?php echo $v['shouji'];?>
			    	</span>
			    	<span><?php echo $v['dianua'];?></span></p>
		        <?php }?>

		    </div>
		    <script>
		    	function save(){
//              省
				var province=$('#s1').val();
				province=$.trim(province);
//				县
				var city=$('#s2').val();
				city=$.trim(city);
//				区
				var county=$('#s3').val();
				county=$.trim(county);
				
				
				if(province=="请选择省"||city=="请选择市"||county=="请选择县（区）"){
					return;
					
				}
				var sjrf=$('#sjr').attr('finish');
				var sjrname=$('#sjr').val();
				var shdzf=$('#shouhuodizhi').attr('finish');
				var shdz=$('#shouhuodizhi').val();
				var youbianf=$('#youbian').attr('finish');
				var youbian=$('#youbian').val();
				var dianhuaf=$('#dianhua').attr('finish');
				var dianhua=$('#dianhua').val();
				var shoujif=$('#shouji').attr('finish');
				var shouji=$('#shouji').val();
				if(sjrf&&shdzf&&youbianf&&dianhuaf&&shoujif){
					var addaddress='<p><input type="radio" name="receiveaddress" class="added" checked/>'+
			    	'<span class="name">'+
			    	sjrname+
			    	'</span>'+
			    	'<span class="shaddress">'+
			    	shdz+
			    	'</span>'+
			    	'<span>'+province+'</span>'+
			    	'<span class="small">'+city+'</span>'+
			    	'<span class="small">'+county+'</span>'+
			    	'<span class="small">'+youbian+'</span>'+
			    	'<span class="yb">电话</span>'+
			    	'<span>'+
			    		shouji+
			    	'</span>'+
			    	'<span>'+dianhua+'</span></p>';
			    	$("#saveaddress").append(addaddress);
			    	$(".address").hide();

			    	
			    	
					
				}
        			    $.ajax({
        				type:"post",
        				url:"<?php echo U('saveAddress');?>",
        				data:{'sjrname':sjrname,'shdz':shdz,'youbian':youbian,'dianhua':dianhua,'shouji':shouji,'province':province,'city':city,'county':county},
        				dataType:'json',
        				success:function(phpData){
       						
        				
        						
        						
        					
        					
        				}
        			})
				
                

               }
		    </script>
		    <script>
		    	$(".otheraddress").click(function(){
		    		$('.address').show();
		    		
		    	})

		    </script>
		    <script>
		    $(".added").click(function(){
		    	alert("mmmm");
		    })
		    	
		    </script>
		    
		    <h2 class="shdz">支付方式</h2>
		    <div class="useaddr">
		    	在线支付
		    </div>
		    <h2 class="shdz">发票信息</h2>
		    <div class="check">
			    <form action="" method="post">
			    	<table>
			    		<tr>
			    			<td>普通发票</td>
			    			<td></td>
			    		</tr>
			    		<tr>
			    			<td>发票抬头：</td>
			    			<td><input type="radio" name="check[]" checked />个人
			    				&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
			    				<!--<input type="radio" name="check[]" />
			    				单位（请确认单位名称正确,以免因名称错误耽搁您的报销）-->
			    			</td>
			    			
			    		</tr>
			    		<!--<tr>
			    			<td>单位名称：<input type="text" class="dwmc"/></td>
			    			<td></td>
			    		</tr>-->
			    	</table>
			    </form>
		    </div>
		    <h2 class="shdz">商品清单</h2>
		    <div class="spqdjt">
		    	<table border="1">
		    		<th>商品名称</th>
		    		<th>单价</th>
		    		<th>数量</th>
		    		<th>小计</th>
		    		<?php foreach ($goodsData as $k=>$v){?>
		    		<tr>
		    			<td><?php echo $v['name'];?></td>
		    			<td><?php echo $v['price'];?></td>
		    			<td><?php echo $v['num'];?></td>
		    			<td><?php echo $v['total'];?></td>
		    		</tr>
		    		<?php }?>
		    		
		    	</table>
		    </div>
		    <div class="total">
		    	<!--<p class="lirow"><b></b>使用优惠劵</p>
		    	<p class="lirow niudou"><b></b>使用牛豆支付</p>-->
		    	<div class="bigbot">
			    	<p class="brow">商品总额：<span>￥<?php echo $alltotal;?></span></p>
			    	<!--<p class="brow"><strong>+</strong>配送费用：<span>￥00.00</span></p>-->
			    	<p class="brow">总计：<span>￥<?php echo $alltotal;?></span></p>
			    	<input type="submit" class="submit"/>
		    	</div>

		    </div>
		    <div class="aboutus">
					<div class="alink">
						<a href="">关于我们</a>
						<a href="">联系我们</a>
						<a href="">新闻中心</a>
						<a href="">加入我们</a>
						<a href="">公益</a>
						<a href="">星空之约</a>
					</div>
					<p>
						2012-2015 努比亚 版权所有 粤ICP备10006213号-2 ICP经营许可证编号：粤B2-20120688深圳市市场监督管理局企业主体身份公示 努比亚技术有限公司
					</p>
					
					<div class="asright">
						<a href="" class="weather">
						</a>
						<a href="" class="phone">

						</a>
						<a href="" class="ewm">
						</a>
						<a href=""  class="service">
						</a>
						<span>
							
						</span>
					</div>
			</div>
		    

		 
		<!--<input type="text" />-->
	</body>
</html>
